<template>
	<view class="u-padding-20">
		<view class="list">
			设备信息
		</view>
		<view class="shadow_con u-padding-20 u-rela">
			<view class="list">
				设备编号：{{detail.code}}
			</view>
			<view class="list">
				设备名称：{{detail.name}}
			</view>
			<view class="list">
				设备位置：{{detail.address}}
			</view>
			<view class="list">
				设备简述：{{detail.desc}}
			</view>
			
			<view class="list" v-if="detail.type==0">
				设备巡期：日巡
			</view>
			<view class="list" v-if="detail.type==1">
				设备巡期：周巡
			</view>
			<view class="list" v-if="detail.type==2">
				设备巡期：月巡
			</view>
			<view class="list" v-if="detail.type==3">
				设备巡期：年巡
			</view>
			<view class="list">
				巡查次数：<text style="color:#0B868E;">{{detail.num}}</text>/{{detail.total}}
			</view>
			<view class="list">
				设备图片：
				<image class="img_con" :src="detail.image" mode="heightFix"></image>
			</view>
			
			<view v-if="examine[0].complete==1" style="color:#0B868E;" class="u-abso dis_inl_blo pos_right pos_top">
				已巡查
			</view>
			<view v-else style="color:#0B868E;" class="u-abso dis_inl_blo pos_right pos_top">
				待巡查
			</view>
		</view>
		<view class="list u-margin-top-20" v-if="examine[0].complete==1">
			巡查信息
		</view>
		
		<view class="shadow_con u-padding-20 u-rela" v-if="examine[0].complete==1">
			<view class="u-rela u-border-bottom" v-for="(item,index) in examine" :key="index">
				<view class="list">
					巡查工作人员：{{item.author}}
				</view>
				<view class="list">
					巡查结果简述：{{item.memo}}
				</view>
				<view class="shadow_con">
					<view class="list_con2" v-for="(ite,inde) in item.content" :key="inde">
						<view style="margin-bottom:30rpx;">
							{{inde+1}}、{{ite.name}}
						</view>
						<view>{{ite.select}}</view>
					</view>
				</view>
				<view class="list">
					巡查时间：{{item.time}}
				</view>
				<view class="list" style="border: none;" v-if="item.images.length>0">
					巡查图片：
					<view style="vertical-align: top;" class="u-margin-top-20 u-text-center">
						<image class="imgs_con" v-for="(ite,inde) in item.images" :src="ite" mode="widthFix"></image>
					</view>
					
				</view>
				<view v-if="item.status==1" style="color:#18B566;" class="u-abso dis_inl_blo pos_right pos_top">
					正常
				</view>
				<view v-else style="color:#ff0000;" class="u-abso dis_inl_blo pos_right pos_top">
					异常
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {
		getPatrolDetail
	} from "@/service/patrolService.js";
	export default {
		data () {
			return {
				detail:{},
				examine:{}
			}
		},
		onLoad(options) {
			getPatrolDetail({
				code: options.code
			}).then(this.getPatrolDetail);
		},
		methods:{
			getPatrolDetail(e) {
				// console.log(e)
				if (e.code == 200) {
					this.detail=e.result;
					this.examine=e.result.examine
				}
			},
		}
	}
</script>

<style lang="scss">
	.shadow_con{
		box-shadow: 0 0 15rpx #ddd;
		border-radius: 10rpx;
		color:#555;
	}
	.list{
		padding:20rpx 0;
	}
	.list_con2{
		padding:20rpx;border-bottom:5rpx solid #f2f2f2;
		background-color: #fff;
	}
	
	.text_con{
		textarea{
			width:94%;
			padding:20rpx;
			border-radius: 15rpx;
			background-color: #f8f8f8;
		}
	}
	.img_con{
		// width:40%;
		height: 200rpx;
		display: block;
		margin:20rpx auto 0;
	}
	.imgs_con{
		display: inline-block;
		width:30%;
		margin:10rpx;
	}
</style>
